package cn.edu.tju.elm.model;

import cn.edu.tju.core.model.BaseEntity;
import cn.edu.tju.core.model.User;
import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

/**
 * ClassName: Complain
 * Package: cn.edu.tju.elm.model
 * Description: 投诉实体类
 * 
 * 状态说明:
 * 0 - 待审核（初始状态）
 * 1 - 商家已拒绝
 * 2 - 已通过（商家或管理员同意）
 * 3 - 管理员已拒绝
 *
 * @Author System
 * @Create 2025/10/31
 * @Version 1.0
 */
@Entity
@Table(name = "complains")
public class Complain extends BaseEntity {

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id", nullable = false)
    @NotNull(message = "用户不能为空")
    private User customer;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "business_id", nullable = false)
    @NotNull(message = "商家不能为空")
    private Business business;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "order_id", nullable = false)
    @NotNull(message = "订单不能为空")
    private Order order;

    @Column(columnDefinition = "TEXT", nullable = false)
    @NotBlank(message = "投诉内容不能为空")
    private String content;

    /**
     * 投诉状态：
     * 0 - 待审核
     * 1 - 商家已拒绝
     * 2 - 已通过
     * 3 - 管理员已拒绝
     */
    @Column(nullable = false)
    private Integer state = 0;

    @Column(columnDefinition = "TEXT")
    private String businessReply;

    @Column(columnDefinition = "TEXT")
    private String adminReply;

    public Complain() {
    }

    public User getCustomer() {
        return customer;
    }

    public void setCustomer(User customer) {
        this.customer = customer;
    }

    public Business getBusiness() {
        return business;
    }

    public void setBusiness(Business business) {
        this.business = business;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getBusinessReply() {
        return businessReply;
    }

    public void setBusinessReply(String businessReply) {
        this.businessReply = businessReply;
    }

    public String getAdminReply() {
        return adminReply;
    }

    public void setAdminReply(String adminReply) {
        this.adminReply = adminReply;
    }
}

